<div class="panel panel-default">
    <div class="panel-body">
        <h1><span class="glyphicon glyphicon-bullhorn"></span>
            News <a href="#"></a>
        </h1>
        <?php if ($this->sliderArticles) { ?>
            <div id="newsCarousel" class="carousel slide" data-ride="carousel">
                <div class="row">
                    <div class="col-md-8">
                        <div class="carousel-inner">
                            <?php for ($i = 0; $i < count($this->sliderArticles); $i++) { ?>
                                <div class="item <?php if ($i == 0) echo "active" ?>">
                                    <img alt="" src="<?php echo $this->baseUrl() ?>/upload/news/<?= $this->sliderArticles[$i]["sliderImage"] ?>" />
                                    <div class="carousel-caption">
                                        <a href="<?php echo $this->baseUrl() ?>/news/view/id/<?= $this->sliderArticles[$i]["id"] ?>"><h3><?= $this->sliderArticles[$i]["title"] ?></h3></a>
                                        <p><?php
                                            $strippedString = strip_tags($this->sliderArticles[$i]["body"]);
                                            $formatedString = (strlen($strippedString) > 300) ? substr($strippedString, 0, 295) . '...' : $strippedString;
                                            echo $formatedString;
                                            ?></p>
                                    </div>
                                </div><!-- End Item -->

                            <?php } ?>
                            <!-- Controls -->
                            
                        </div>
                        <div class="carousel-controls">
                                <a class="left carousel-control" href="#newsCarousel" data-slide="prev">
                                    <span class="glyphicon glyphicon-chevron-left"></span>
                                </a>
                                <a class="right carousel-control" href="#newsCarousel" data-slide="next">
                                    <span class="glyphicon glyphicon-chevron-right"></span>
                                </a>
                            </div>
                        <!-- End col8 -->
                    </div>
                    <div class="col-md-4">
                        <ul class="list-group">
                            <?php for ($i = 0; $i < count($this->sliderArticles); $i++) { ?>
                                <li data-slide-to="<?= $i ?>" data-target="#newsCarousel" class="list-group-item <?php if ($i == 0) echo "active" ?>"><h4><?= $this->sliderArticles[$i]["title"] ?></h4></li>
                            <?php } ?>
                        </ul>
                        <!-- End col4 -->
                    </div>
                </div>


            </div>

        <?php } ?>

        <?php
        if ($this->paginator) {
            ?>
            <?php
            foreach ($this->paginator as $article) {
                ?>
                <div id="article">
                    <a href="<?php echo $this->baseUrl() ?>/news/view/id/<?= $article["nId"] ?>"><h3><?= $article["title"] ?></h3></a>
                    <div class="breadcrumb">
                        <span class="glyphicon glyphicon-user">&nbsp;</span><?= $article["firstName"] . " " . $article["lastName"] ?> |&nbsp;
                        <span class="glyphicon glyphicon-time">&nbsp;</span> <?= $article["createdOn"] ?> |&nbsp;
                        <span class="glyphicon glyphicon-folder-open">&nbsp;</span><a href="<?php echo $this->baseUrl() ?>/news/list/categoryId/<?= $article["id"] ?>" ><?= $article["name"] ?></a>&nbsp;|&nbsp;
                        <span class="glyphicon glyphicon-comment">&nbsp;</span><a href="<?php echo $this->baseUrl() ?>/news/view/id/<?= $article["nId"] ?>#disqus_thread" ></a>
                    </div>
                    <p><?php
                        $strippedString = strip_tags($article["body"]);
                        $formatedString = (strlen($strippedString) > 500) ? substr($strippedString, 0, 495) . '...' : $strippedString;
                        echo $formatedString;
                        ?></p>
                    <a class="label label-primary" href="<?php echo $this->baseUrl() ?>/news/view/id/<?= $article["nId"] ?>">Read More</a>
                </div>
                <?php
            }


            echo $this->paginationControl($this->paginator, 'sliding', 'pagination.phtml');
        }
        ?>

    </div>
</div>
<script type="text/javascript">
    /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
    var disqus_shortname = 'ostd'; // required: replace example with your forum shortname

    /* * * DON'T EDIT BELOW THIS LINE * * */
    (function() {
        var s = document.createElement('script');
        s.async = true;
        s.type = 'text/javascript';
        s.src = 'http://' + disqus_shortname + '.disqus.com/count.js';
        (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
    }());
</script>